import { http } from '@/utils/request'
import type { PageParams } from "@/types/order"

// 获得待接单列表分页
export const getWaitOrderPage = (data: PageParams) => {
    return http({
        method: 'GET',
        url: '/app-api/worker/order/getWaitOrderPage',
        data
    })
}
// 获得已接单列表分页
export const getAcceptOrderPage = (data: PageParams) => {
    return http({
        method: 'GET',
        url: '/app-api/worker/order/getAcceptOrderPage',
        data
    })
}
// 查询订单详情
export const getWorkerOrderDetail = (id: string) => {
    return http({
        method: 'GET',
        url: '/app-api/worker/order/get',
        data: {
            id
        }
    })
}
// 抢单
export const makeOrder = (data:any) => {
    return http({
        method: 'PUT',
        url: '/app-api/worker/order/makeOrder',
        data
    })
}
// 取消订单
export const cancelOrder = (data:any) => {
    return http({
        method: 'PUT',
        url: '/app-api/worker/order/cancelOrder',
        data
    })
}
// 获得工程节点
export const getNewNode = (orderId: string) => {
    return http({
        method: 'GET',
        url: '/app-api/customer/node/getNewNode',
        data: {
            orderId
        }
    })
}
// 获得工程节点
export const getNewNodePage = (orderId: string) => {
    return http({
        method: 'GET',
        url: '/app-api/worker/node/page',
        data: {
            orderId
        }
    })
}
// 打卡
export const workerCheckCard = (data: any) => {
    return http({
        method: 'PUT',
        url: '/app-api/worker/order/checkCard',
        data
    })
}
// 完工拍照
export const workerCheckPhoto = (data: any) => {
    return http({
        method: 'POST',
        url: '/app-api/worker/node/finshWorkNode',
        data
    })
}
// 获取完工拍照照片
export const getWorkerCheckPhoto = (nodeId: any) => {
    return http({
        method: 'GET',
        url: '/app-api/worker/node-image/page',
        data:{
            nodeId
        }
    })
}